import java.io.*;

public class Answer3 {
    //倒置字符串
    public static void main(String[] args) throws Throwable {

        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        char[] c = in.readLine().toCharArray();
        int n = c.length;
        int left = 0;

        reverse(c, left, n-1);

        while ( left < n) {
            int right = left;
            while ( right < n && c[right] != ' ') right++;      // 找单词范围
            reverse(c, left, right-1);
            while ( right < n && c[right] == ' ') right++; // 剔除空格
            left = right;
        }


        for (char ch : c) {
            System.out.print(ch);
        }
    }

    public static void reverse(char[] c, int l, int r) {
        while (l <= r) {
            char tmp = c[l];
            c[l] = c[r];
            c[r] = tmp;
            l++;
            r--;
        }
    }
}
